use MSE6DB
go

delete [ServiceEngine].[Policies]
go

delete [ServiceEngine].[Names] where EntityClass = 8 --Policies
go

DECLARE @RC int
DECLARE @Name nvarchar(400)
DECLARE @PolicyXml xml
DECLARE @Description nvarchar(400)
DECLARE @ID uniqueidentifier

set @Name='Turn off MetaData Publishing'
set @PolicyXml = N'<PolicyModel xmlns="http://microsoft.com/mse/2007/runtime/policyModel" xmlns:mse="http://services.microsoft.com/MSE" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wcf="clr-namespace:System.ServiceModel.Configuration;assembly=System.ServiceModel">
  <wcf:ServiceMetadataPublishingElement HttpGetEnabled="false" HttpGetUrl="/">
  </wcf:ServiceMetadataPublishingElement>
</PolicyModel>'
set @Description = N'This policy can be used to disable metadata publishing at an endpoint.'
set @ID = '{00000000-0000-0000-0000-A00000000001}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreatePolicy] 
   @Name
  ,@PolicyXml
  ,@Description
  ,@ID OUTPUT



set @Name='WCF Throttling Override'
set @PolicyXml = N'<PolicyModel xmlns="http://microsoft.com/mse/2007/runtime/policyModel" xmlns:mse="http://services.microsoft.com/MSE" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wcf="clr-namespace:System.ServiceModel.Configuration;assembly=System.ServiceModel">
  <wcf:ServiceThrottlingElement MaxConcurrentCalls="10" MaxConcurrentSessions="10" MaxConcurrentInstances="2">
  </wcf:ServiceThrottlingElement>
</PolicyModel>'
set @Description = N'This policy can be used to tweak the WCF throttling configuration at an endpoint.'
set @ID = '{00000000-0000-0000-0000-A00000000002}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreatePolicy] 
   @Name
  ,@PolicyXml
  ,@Description
  ,@ID OUTPUT


set @Name='RegEx Filter'
set @PolicyXml = N'<PolicyModel xmlns="http://microsoft.com/mse/2007/runtime/policyModel" xmlns:mse="http://services.microsoft.com/MSE" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wcf="clr-namespace:System.ServiceModel.Configuration;assembly=System.ServiceModel" xmlns:regEx="clr-namespace:Microsoft.MSE.Behaviors.RegExContentFilter;assembly=Microsoft.MSE.Behaviors.RegExContentFilter">
  <regEx:RegExContentBehaviorExtensionElement>
    <regEx:RegPatternItem>
      <regEx:RegPatternItem.Pattern>AddDoublesResult</regEx:RegPatternItem.Pattern>
      <regEx:RegPatternItem.Replacement>sum</regEx:RegPatternItem.Replacement>
    </regEx:RegPatternItem>   
  </regEx:RegExContentBehaviorExtensionElement> 
</PolicyModel>'
set @Description = N'This policy can be used to enable Regular Expression filtering across messages.'
set @ID = '{00000000-0000-0000-0000-A00000000003}'

EXECUTE @RC = [MSE6DB].[ServiceEngine].[CreatePolicy] 
   @Name
  ,@PolicyXml
  ,@Description
  ,@ID OUTPUT
